import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import React from 'react';

import styles from './index.module.css';

function AnnouncementBanner() {
  return (
    <div className={styles.announcementBanner}>
      <div className="container">
        <div className={styles.announcementContent}>
          <span className={styles.announcementEmoji}>🎉</span>
          <span className={styles.announcementText}>
            技术学习导航 2025 已发布！
          </span>
          <span className={styles.announcementEmoji}>🥳</span>
        </div>
      </div>
    </div>
  );
}

function HomepageHeader() {
  const {siteConfig} = useDocusaurusContext();
  return (
    <header className={clsx('hero', styles.heroBanner)}>
      <div className="container">
        <div className={styles.heroInner}>
          <div className={styles.heroText}>
            <h1 className={styles.heroTitle}>
              Zfank
              <span className={styles.heroTitleColorful}>站点知识分享</span>
            </h1>
            <div className={styles.buttons}>
              <Link
                className="button button--primary button--lg"
                to="/docs/intro">
                入门指南
              </Link>
              <Link
                className="button button--info button--lg"
                to="/docs/python">
                试用一下
              </Link>
              <iframe
                src="https://ghbtns.com/github-btn.html?user=facebook&repo=docusaurus&type=star&count=true&size=large"
                frameBorder="0"
                scrolling="0"
                width="170"
                height="30"
                title="GitHub Stars"
                className={styles.githubButton}
              />
            </div>
          </div>
          <div className={styles.heroLogo}>
            <img 
              src="/img/logo.svg" 
              alt="技术学习导航" 
              className={styles.heroLogoImg}
            />
          </div>
        </div>
      </div>
    </header>
  );
}

export default function Home() {
  const {siteConfig} = useDocusaurusContext();
  return (
    <Layout
      title={`Zfank ${siteConfig.title}`}
      description="学习网站">
      <AnnouncementBanner />
      <HomepageHeader />
      <main>
        <HomepageFeatures />
      </main>
    </Layout>
  );
}